package net.ads.log;

import cn.hutool.Hutool;
import cn.hutool.http.useragent.UserAgent;
import cn.hutool.http.useragent.UserAgentUtil;
import org.apache.hadoop.hive.ql.exec.UDF;

import java.util.HashMap;
import java.util.Map;

public class PareUaSer extends UDF {
    public String evaluate(String uaStr) throws Exception{

        Map<String,String> map=new HashMap<String,String>();

        UserAgent ua = UserAgentUtil.parse(uaStr);

        ua.getBrowser().toString();
        ua.getVersion();
        ua.getEngine().toString();
        ua.getEngineVersion();
        ua.getOs().toString();
        ua.getPlatform().toString();

        return map
    }


    public static void main(String[] args) throws Exception {
        System.out.println(new PareUaSer().evaluate("Mozilla/5.0%20(X11;%20U;%20Linux%20i686;%20en-GB;%20rv:1.9.1.3)%20Gecko/20090824%20Firefox/3.5.3%20GTB5"));
    }
}
